-
Notifications
You must be signed in to change notification settings - Fork 792
Adds MapGrpcService overload for ServerServiceDefinition #2586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Adds MapGrpcService overload for ServerServiceDefinition #2586
Conversation
This is great and exactly what I needed. Currently, I copy the service code generated by |
…2597) Co-authored-by: Günther Foidl <[email protected]>
…rpc#2599) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ttps://github.com/aka-nse/grpc-dotnet into feature/MapGrpcService-with-ServerServiceDefinition
…ttps://github.com/aka-nse/grpc-dotnet into feature/MapGrpcService-with-ServerServiceDefinition
Is this ever going to be implemented? |
@floozie |
This is a duplicate of #2535.
I made a serious operational error while tracking master, so I created a new pull request.
I apologize for the inconvenience.
Is your feature request related to a problem? Please describe.
This PR is implement for #2236.
ServerServiceDefinition
is defined in Grpc.Core.Api library, and it was a prefer way to implement gRPC server with Grpc.Core.In current grpc-dotnet, the server should be implemented on Asp.Net web application DI container via
GrpcEndpointRouteBuilderExtensions.MapGrpcService
generic method.The APIs in this proposal bridges legacy way into grpc-dotnet to enable to migrate easier.
Describe the solution you'd like
2 overloads of
GrpcEndpointRouteBuilderExtensions.MapGrpcService
are added:This change enables to map gRPC services via
Grpc.Core.ServerServiceDefinition
, therefore migration from Grpc.Core can be more easier.Changes in this PR
Grpc.Core.Api
Grpc.Core.ServerServiceDefinition.BindService(ServiceBinderBase)
method as public*Grpc.AspNetCore.Server
Microsoft.AspNetCore.Builder.GrpcEndpointRouteBuilderExtensions
classMapGrpcService(this IEndpointRouteBuilder, ServerServiceDefinition)
*MapGrpcService(this IEndpointRouteBuilder, Func<IServiceProvider, ServerServiceDefinition>)
*ServerCallHandlerFactory
andServiceRouteBuilder
(non-generic) onMicrosoft.Extensions.DependencyInjection.AddServiceOptions
method**Grpc.AspNetCore.Server.Internal.EndpointServiceBinder
to bind methods inServerServiceDefinition
into ASP.Net core web application server*Grpc.AspNetCore.Server.Internal.ServerCallHandlerFactory
class*Grpc.AspNetCore.Server.Model.Internal.ServiceRouteBuilder
class*ServerCallHandlerBase
*,UnaryServerCallhandler
*,ServerStreamingServerCallHandler
*,ClientStreamingServerCallHandler
*, andDuplexStreamingServerCallHandler
* classes inGrpc.AspNetCore.Server.Internal.CallHandlers
namespaceServerMethodInvokerBase
*,UnaryServerMethodInvoker
*,ServerStreamingServerMethodInvoker
*,ClientStreamingServerMethodInvoker
*, andDuplexStreamingServerMethodInvoker
* classes inGrpc.Shared.Server
namespaceServerCallHandlerFactory
andServerCallHandlerFactory<TService>
intoIServerCallHandlerFactory
*test
MapGrpcService
examples
Grpc.AspNetCore.Server.Tests.TestObjects.Services.WithAttribute.GreeterWithAttribute.BindService
methodDescribe alternatives you've considered
This commit contains concrete code as far as I can write, but I do not care about these implementations.
I welcome better ways to realize this suggestion.
Additional context
No response